Model Context Protocol implementation for UTCP
The MCP (Model Context Protocol) provider enables UTCP to interoperate with services that implement the Model Context Protocol, providing seamless compatibility and bidirectional communication between UTCP and MCP ecosystems for enhanced tool interoperability.
This provider type is currently a Work In Progress (WIP) and may be subject to changes as both UTCP and MCP protocols continue to evolve.
MCP providers are configured using the following JSON structure:
{ "name": "mcp_service", "provider_type": "mcp", "config": { "mcpServers": { "stdio_server": { "transport": "stdio", "command": "mcp-server", "args": ["--port", "8080"], "env": { "MCP_API_KEY": "$YOUR_API_KEY" } }, "http_server": { "transport": "http", "url": "https://mcp.example.com/stream" } } }, "auth": { "auth_type": "oauth2", "client_id": "$YOUR_CLIENT_ID", "client_secret": "$YOUR_CLIENT_SECRET", "token_url": "https://auth.example.com/token" } }
Field | Required | Description |
---|---|---|
name |
Yes | Unique identifier for the provider |
provider_type |
Yes | Must be set to "mcp" |
config |
Yes | MCP configuration object containing server definitions |
config.mcpServers |
Yes | Dictionary of MCP server configurations |
auth |
No | Authentication configuration (OAuth2 type) |
MCP servers can use different transport mechanisms for communication. Each transport type has specific configuration requirements:
For servers connected via standard input/output streams.
Field | Required | Description |
---|---|---|
transport |
Yes | Must be "stdio" |
command |
Yes | The command to launch the MCP server |
args |
No | Command line arguments for the MCP server |
env |
No | Environment variables for the MCP server |
For servers connected via streamable HTTP endpoints.
Field | Required | Description |
---|---|---|
transport |
Yes | Must be "http" |
url |
Yes | The URL of the MCP server's streaming endpoint |
MCP providers support OAuth2 authentication for secure communication with MCP servers:
{ "auth": { "auth_type": "oauth2", "client_id": "$YOUR_CLIENT_ID", "client_secret": "$YOUR_CLIENT_SECRET", "token_url": "https://auth.example.com/token", "scope": "mcp:read mcp:write" } }
For MCP providers, UTCP tools are discovered through the MCP server's own discovery mechanism and then automatically mapped to UTCP tool definitions.
Tools are discovered using MCP's native tool discovery protocol and capabilities exchange.
MCP tool definitions are automatically translated to UTCP format for seamless integration.
The MCP provider serves as a bridge between UTCP and MCP ecosystems, enabling:
UTCP clients can access tools from MCP servers with automatic protocol translation.
MCP clients can access UTCP tools through an MCP adapter interface.
When a tool associated with an MCP provider is called, the following process occurs:
Translate the UTCP tool call into MCP tool call format
Send the request to the appropriate MCP server
Wait for and process the MCP server's response
Translate the MCP response back into UTCP format
Return the result according to the tool's output schema
{ "name": "ai_models", "provider_type": "mcp", "config": { "mcpServers": { "llm": { "transport": "stdio", "command": "mcp-llm-server", "args": ["--models", "all"], "env": { "MODEL_API_KEY": "$YOUR_MODEL_API_KEY" } } } } }
{ "name": "filesystem", "provider_type": "mcp", "config": { "mcpServers": { "fs": { "transport": "stdio", "command": "mcp-filesystem-server", "args": ["--root", "/safe/directory"], "env": { "FS_READ_ONLY": "false" } } } } }
{ "name": "web_service", "provider_type": "mcp", "config": { "mcpServers": { "web": { "transport": "http", "url": "https://mcp-web-service.example.com/stream" } } }, "auth": { "auth_type": "oauth2", "client_id": "$WEB_CLIENT_ID", "client_secret": "$WEB_CLIENT_SECRET", "token_url": "https://auth.example.com/token" } }
Example of a tool definition automatically discovered from an MCP server:
{ "name": "generate_text", "description": "Generate text from a prompt using an AI model", "inputs": { "type": "object", "properties": { "prompt": { "type": "string", "description": "The prompt to generate text from" }, "model": { "type": "string", "description": "Model to use", "default": "default-model" }, "max_tokens": { "type": "integer", "description": "Maximum tokens to generate", "default": 100 } }, "required": ["prompt"] }, "outputs": { "type": "object", "properties": { "text": { "type": "string", "description": "Generated text" } } } }
© 2024 Universal Tool Calling Protocol. All rights reserved.